package com.example.reader.service;

import cn.hutool.core.date.DateUtil;

import com.example.reader.entity.Account;

import com.example.reader.entity.Cart;
import com.example.reader.entity.Orders;

import com.example.reader.mapper.OrderMapper;
import com.example.reader.utils.TokenUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderService {
    @Autowired
    private OrderMapper orderMapper;
    public void add(Orders orders){
        //获取到当前用户信息
        Account account= TokenUtils.getCurrentUser();
        orders.setUserId(account.getId());
        orders.setTime(DateUtil.now());
        orderMapper.insert(orders);
    }

}
